package debby.bdmap.utils

import io.reactivex.Observable
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.functions.Consumer
import io.reactivex.schedulers.Schedulers
import java.util.concurrent.TimeUnit

/**
 * Created by debby on 2018/7/10.
 * 描述:延时操作
 */
fun <T> delayFunction(t: T, delay: Long, consumer: Consumer<T>) {
    Observable.just(t)
            .delay(delay, TimeUnit.MILLISECONDS)
            .subscribeOn(Schedulers.newThread())
            .observeOn(AndroidSchedulers.mainThread())
            .subscribe(consumer)
}